package com.itheima.user.controller;

import com.itheima.common.vo.ResultVo;
import com.itheima.user.dto.LoginDto;
import com.itheima.user.pojo.ApUser;
import com.itheima.user.service.ApUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
 * @version 1.0
 * @description 说明
 * @package com.itheima.user.controller
 */
@RestController
@RequestMapping("/login")
public class LoginController {

    @Autowired
    private ApUserService apUserService;

    /**
     * 登录校验
     * @param loginDto
     * @return
     */
    @PostMapping("/login_auth")
    public ResultVo<ApUser> loginAuth(@RequestBody LoginDto loginDto){
        Map<String,Object> resultVo = apUserService.loginCheck(loginDto);
        return ResultVo.ok(resultVo);
    }
}
